home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / shape.lha / shape / gslist.h next >
C/C++ Source or Header  |  1993-08-08  |  753b  |  28 lines

  1. ifndef GSLIST_H
  2. define GSLIST_H
  3. include "slist.h"
  4. include <generic.h>
  5.  
  6. define gslist(type) name2(type,gslist)
  7. define gslist_iterator(type) name2(type,gslist_iterator)
  8.  
  9. define gslistdeclare(type)                \
  10. struct gslist(type) : slist {            \
  11.     int insert(type a)                \
  12.     { return slist::insert(ent(a)); }    \
  13.     int append(type a)                \
  14.     { return slist::append(ent(a)); }    \
  15.     type get() { return type(slist::get()); }    \
  16.     gslist(type)() { }                \
  17.     gslist(type)(type a) : (ent(a)) {}        \
  18.     ~gslist(type)() { clear(); }        \
  19. };                        \
  20.                         \
  21. struct gslist_iterator(type) : slist_iterator {    \
  22.     gslist_iterator(type)(gslist(type)& s)    \
  23.         : ((slist&)s) {}            \
  24.     type operator()()                \
  25.         { return type(slist_iterator::operator()()); } \
  26. };
  27. endif
  28.